import { Component, OnInit, Injector, ViewEncapsulation, ViewChild, AfterViewInit } from '@angular/core';
import { AppComponentBase } from '@shared/common/app-component-base';
import { appModuleAnimation } from '@shared/animations/routerTransition';
import { MaterialIntoServiceProxy, SignMaterialForProductInput } from '@shared/service-proxies/service-proxies';
import { LazyLoadEvent, Paginator } from 'primeng/primeng';
import { AppConsts } from '@shared/AppConsts';

@Component({
  selector: 'app-into',
  templateUrl: './into.component.html',
  styleUrls: ['./into.component.less'],
  encapsulation: ViewEncapsulation.None,
  animations: [appModuleAnimation()]
})
export class MaterialIntoComponent extends AppComponentBase implements OnInit {

  @ViewChild('paginator') paginator: Paginator;

  filterText = '';

  hgzNo = '';


  constructor(
    injector: Injector,
    private _warehouseIntoServiceProxy: MaterialIntoServiceProxy
  ) {
    super(injector);
  }

  ngOnInit(): void {
    //this.getBills();
  }

  scanBillByHgzNo() {
    var hgz = new SignMaterialForProductInput();
    hgz.certificationNo = this.hgzNo;
    this._warehouseIntoServiceProxy.scanMaterialByHgz(hgz)
      .subscribe(result => {
        this.hgzNo = '';
        //this.getBills();
      });
  }

  // getBills(event?: LazyLoadEvent) {
  //   if (this.primengTableHelper.shouldResetPaging(event)) {
  //     this.paginator.changePage(0);
  //     return;
  //   }

  //   this.primengTableHelper.showLoadingIndicator();

  //   this._warehouseIntoServiceProxy.getReleaseStockBills(
  //     this.filterText,
  //     undefined,
  //     12,
  //     this.primengTableHelper.getSkipCount(this.paginator, event)
  //   )
  //     .subscribe(result => {
  //       this.primengTableHelper.totalRecordsCount = result.totalCount;
  //       this.bills = result.items;
  //       this.primengTableHelper.hideLoadingIndicator();
  //     });
  // }

  // deleteWl(wl: WlReleaseStockBillListDto): void {

  //   this.message.confirm(
  //     '确认删除' + wl.materialName + '吗？',
  //     this.l('AreYouSure'),
  //     (isConfirmed) => {
  //       if (isConfirmed) {
  //         this._warehouseIntoServiceProxy.deleteReleaseStockBill(wl.id)
  //           .subscribe(() => {
  //             this.getBills();
  //             this.notify.success(this.l('SuccessfullyDeleted'));
  //           });
  //       }
  //     }
  //   );
  // }

}
